#include <gtest\gtest.h>
#include <Vector2D.h>
using namespace Math;

TEST(Vector2D, Constructor)
{
	Vector2D first(1, 2);
	Vector2D second(2, 4);

	EXPECT_FLOAT_EQ(1, first.x);
	EXPECT_FLOAT_EQ(2, first.y);
	EXPECT_FLOAT_EQ(2, second.x);
	EXPECT_FLOAT_EQ(4, second.y);
}

TEST(Vector2D, VectorAddition)
{
	Vector2D first(1, 2);
	Vector2D second(2, 4);
	Vector2D result1 = first + second;
	Vector2D result2 = second + first;

	EXPECT_FLOAT_EQ(3, result1.x);
	EXPECT_FLOAT_EQ(6, result1.y);

	EXPECT_FLOAT_EQ(result2.x, result1.x);
	EXPECT_FLOAT_EQ(result2.y, result1.y);
}

TEST(Vector2D, VectorScalarMultiplication)
{
	float scalar = 3.0f;
	Vector2D first(2, 4);
	Vector2D result1 = scalar*first;
	Vector2D result2 = first*scalar;

	EXPECT_FLOAT_EQ(6, result1.x);
	EXPECT_FLOAT_EQ(12, result1.y);

	EXPECT_FLOAT_EQ(result2.x, result1.x);
	EXPECT_FLOAT_EQ(result2.y, result1.y);
}
